<?php

namespace App\Http\Controllers\Wechat;

use Laravel\Lumen\Routing\Controller as BaseController;


class MessageTextController extends BaseController
{
    public static function handle($message)
    {
        // 四级查询: 回复【cet+姓名+准考证号】
        if (strtolower(substr($message->Content, 0, 3)) == 'cet') {
            return Plugins\CetScore::get($message);
        }

        // 账号绑定: 回复【绑定+学号+密码】
        if (substr($message->Content, 0, 6) == '绑定') {
            return Plugins\Register::binding($message);
        }

        // 快递追踪: 回复【快递+单号】
        if (substr($message->Content, 0, 6) == '快递') {
            return Plugins\ExpressTracking::push($message);
        }

        // 反馈建议: 回复【反馈+内容】
        if (substr($message->Content, 0, 6) == '反馈') {
            return Plugins\FeedBack::push($message);
        }

        // 校园网自助服务 账号绑定: 回复【网络+学号+密码】
        if (substr($message->Content, 0, 6) == '网络') {
            return Plugins\Register::bindingNetwork($message);
        }

        if ($message->Content == 'openid') {
            return Messages\Text::simple($message->FromUserName);
        }

//        return Messages\Text::simple('In development');
    }
}